<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('ucenter_id')->index()->nullable();
            $table->string('name');
            $table->string('email')->unique()->nullable();
            $table->string('sms')->unique()->nullable();
            $table->string('password');
            $table->rememberToken();
            $table->string('login_token')->nullable();
            $table->string('head_title')->nullable();
            $table->string('avatar_fid')->nullable();
            $table->string('abstract')->nullable();
            $table->integer('subscriber_count')->default(0);
            $table->integer('essay_count')->default(0);
            $table->string('wechat_openid')->nullable();
            $table->string('wechat_name')->nullable();
            $table->string('weibo_openid')->nullable();
            $table->string('weibo_name')->nullable();
            $table->string('qq_openid')->nullable();
            $table->string('qq_name')->nullable();
            $table->string('real_name')->nullable();
            $table->boolean('sex')->default(1);
            $table->timestamp('last_login')->nullable();
            $table->timestamps();
            $table->softDeletes();
            $table->engine = 'InnoDB';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('users');
    }
}
